<?php

declare (strict_types=1);

namespace App\Models\GameDB\Gashapon;

use App\Models\MainDB\Gift;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;

class PoolQueue extends Model
{
    protected $connection = 'mysql_game';
    protected $table = 'lottery_gashapon_pool_queue';
    //protected $fillable = [];
    protected $guarded = [];

    //protected $casts = ['id' => 'int', 'user_id' => 'integer', 'amount' => 'integer', 'balance' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function one(array $filters, $orderBy = '', $sort = 'asc')
    {
        $query =  self::query()->where($filters);
        if(!empty($orderBy)){
            $query->orderBy($orderBy, $sort);
        }
        return $query->first();
    }

    public function updateData(array $filters, $data)
    {
        return self::query()->where($filters)->update($data);
    }


}